package com.cw.japp

class Users {

	String firstName
	String lastName
	String email
	String description
	String userType
	Date age
	String login
	String password
	String pictureUri
	Date lastLogin
	Integer status
	Date lastModifiedDate
	Date createdDate
	Address address

	static hasMany = [adminAnnouncements: AdminAnnouncement,
	                  chatsForOwnerId: Chat,
	                  chatsForUserId: Chat,
	                  clients: Client,
	                  modelEarnedTokens: ModelEarnedToken,
	                  modelShowTimes: ModelShowTime,
	                  recordings: Recording,
	                  sessionDatas: SessionData,
	                  userChatSettingses: UserChatSettings,
	                  userContactsForOwnerId: UserContact,
	                  userContactsForUserId: UserContact,
	                  userExpenseDetails: UserExpenseDetail,
	                  userProfiles: UserProfile,
	                  userPurchaseDetails: UserPurchaseDetail,
	                  userSettingses: UserSettings,
	                  userTotalAvailableTokens: UserTotalAvailableToken]
	static belongsTo = [Address]

	// TODO you have multiple hasMany references for class(es) [UserContact, Chat] 
	//      so you'll need to disambiguate them with the 'mappedBy' property:
	static mappedBy = [chatsForOwnerId: "usersByOwnerId",
	                   chatsForUserId: "usersByUserId",
	                   userContactsForOwnerId: "usersByOwnerId",
	                   userContactsForUserId: "usersByUserId"]

	static mapping = {
		id column: "user_id"
		version false
	}

	static constraints = {
		description nullable: true
		age nullable: true
		pictureUri nullable: true
		lastLogin nullable: true
		status nullable: true
		lastModifiedDate nullable: true
		createdDate nullable: true
	}
}
